<div class="section">

	<div class="section-title">
    	Insurancere Report
    </div>
    
    <div class="section-content padding1">
    
    	<form id="ProductForm" name="ProductForm"  action="" method="post" enctype="multipart/form-data">
    
    	<div class="left">
            
            <h3>Insurancere Report</h3>
        
        </div>
        
    	<div class="right">
            
            <a class="button" href="index.php"><?php echo $this->document->text['button_cancel']?></a>
            
        </div>
        <div class="clearer">&nbsp;</div>
        
        
        <div id="container"> 
            <div>                        
                <p>
                    <label>Start date</label>
<script language="javascript">
 	$(function() {
		$("#startdate").datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'dd-mm-yy'
				});
		});
 </script>
                    <input class="text" type="text" id="startdate" name="startdate" value="<?php echo $startdate?>" />
                    <label>End date</label>
<script language="javascript">
 	$(function() {
		$("#enddate").datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'dd-mm-yy'
				});
		});
 </script>
                    <input class="text" type="text" id="enddate" name="enddate" value="<?php echo $enddate?>" />
                    <a class="button" onClick="statistics()">Statistics</a>
                </p> 
               
                
            </div>
			<div>                        
                <p>
                    <label>Year</label>
                    <select id="year" name="year">
<?php
	foreach($Year as $item)
    {
    	$sel = "";
    	if($curentyear == $item)
        	$sel='selected="selected"';
?>
						<option value="<?php echo $item?>" <?php echo $sel?> ><?php echo $item?></option>
<?php
    }
?>
                    </select>
                    <label>Month</label>
                    <select id="month" name="month">
<?php
	foreach($Month as $item)
    {
    	$sel = "";
    	if($curentmonth == $item)
        	$sel='selected="selected"';
?>
						<option value="<?php echo $item?>" <?php echo $sel?> ><?php echo $item?></option>
<?php
    }
?>
                    </select>
                    <a class="button" onclick="statisticsByMonth()">Statistics</a>
                </p> 
            </div>
        </div>
        </form>
    </div>
</div>


<div id="reportresult" style="display:none">
	<div id="listorder"></div>
    <a class="button" onclick="printReport(urlreport)">Print</a>
</div>
<script src="<?php echo DIR_JS?>jquery.tabs.pack.js" type="text/javascript"></script>
<script language="javascript">
$(document).ready(function() { 
	$('#reportresult').tabs({ fxSlide: true, fxFade: true, fxSpeed: 'slow' });
});
function statistics()
{
	startdate = $("#startdate").val();
	enddate = $("#enddate").val();
	loadStatistics(startdate,enddate);
	$("#reportresult").show('slow');
}
function statisticsByMonth()
{
	startdate = "01-"+toMonth($("#month").val())+"-"+$("#year").val();
	enddate = daysInMonth($("#month").val(),$("#year").val()) + "-"+ toMonth($("#month").val())+"-"+$("#year").val();
	loadStatistics(startdate,enddate);
	$("#reportresult").show('slow');
}
function loadStatistics(startdate,enddate)
{
	$.blockUI({ message: "<h1>Please wait...</h1>" }); 
	$("#listorder").load("?route=soft/insurancereport/getList&startdate="+startdate+"&enddate="+enddate,function(){
		$.unblockUI();
	});
	urlreport = "?route=soft/insurancereport/getList&startdate="+startdate+"&enddate="+enddate;
}
function printReport(url)
{
	openDialog(url,800,500);
}
var urlreport="";
</script>